﻿Imports Telerik.Web.UI

Partial Class BudgetModify
    Inherits System.Web.UI.Page


    Dim _CommandName As String

    Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Me.Theme = GetGlobalResourceObject("SystemResource", "Theme")
    End Sub

    'Public Overrides ReadOnly Property UniqueID() As String
    '    Get
    '        Return Me.ID
    '    End Get
    'End Property

    'Public Overrides ReadOnly Property ClientID() As String
    '    Get
    '        Return Me.ID
    '    End Get
    'End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim _lblPageTitle As Label
            _lblPageTitle = Me.Master.FindControl("lblPageTitle")
            _lblPageTitle.Text = GetLocalResourceObject("PageTitle")

    
        End If
    End Sub

    Protected Sub rgBudgetModify_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgBudgetModify.ItemCommand
        _CommandName = e.CommandName
    End Sub

    Protected Sub rgBudgetModify_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgBudgetModify.ItemDataBound



        If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) And _CommandName <> "InitInsert" Then
            'If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then

            Dim editFormItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
            Dim parentItem As GridDataItem = editFormItem.ParentItem

            Dim box As RadComboBox = CType(editFormItem.FindControl("WUCProgram").FindControl("rcbv"), RadComboBox)
            box.SelectedValue = parentItem("Program").Text
            Dim box1 As RadComboBox = CType(editFormItem.FindControl("WUCProgram").FindControl("rcbd"), RadComboBox)
            box1.SelectedValue = parentItem("Program").Text

            Dim box2 As RadComboBox = CType(editFormItem.FindControl("WUCAccount").FindControl("rcbv"), RadComboBox)
            box2.SelectedValue = parentItem("Account").Text
            Dim box3 As RadComboBox = CType(editFormItem.FindControl("WUCAccount").FindControl("rcbd"), RadComboBox)
            box3.SelectedValue = parentItem("Account").Text

        End If

    End Sub


End Class
